Skip to content

feat: add AthenaQueryPolicy_v2 with current Athena API actions#3953

Open
roger-zhangg wants to merge 4 commits into
aws:developfrom
roger-zhangg:fix/update-athena-deprecated-apis
Open

feat: add AthenaQueryPolicy_v2 with current Athena API actions#3953
roger-zhangg wants to merge 4 commits into
aws:developfrom
roger-zhangg:fix/update-athena-deprecated-apis

Conversation

@roger-zhangg

@roger-zhangg roger-zhangg commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

Adds AthenaQueryPolicy_v2 with current (non-deprecated) Athena API actions, following the established _v2 pattern.

The original AthenaQueryPolicy is preserved unchanged for backward compatibility (per DEVELOPMENT_GUIDE.md: "A specific SAM template should always transform into the same CloudFormation template").

Changes

  • New: AthenaQueryPolicy_v2 with updated actions (athena:GetWorkGroup, athena:ListDataCatalogs, athena:GetDatabase, athena:ListDatabases, athena:ListTableMetadata, athena:GetTableMetadata) + required Glue Data Catalog permissions (glue:GetDatabase, glue:GetDatabases, glue:GetTable, glue:GetTables)
  • Unchanged: Original AthenaQueryPolicy (deprecated APIs still work, users won't see silent IAM changes on stack update)

Migration

Users should update their SAM templates from AthenaQueryPolicy to AthenaQueryPolicy_v2 at their convenience.

Fixes #3785

@roger-zhangg roger-zhangg requested a review from a team as a code owner July 2, 2026 22:10

@aws-sam-tooling-bot aws-sam-tooling-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Results

Reviewed: da148ea..ac2961c
Files: 4
Comments: 1

Comment thread samtranslator/policy_templates_data/policy_templates.json Outdated
Adds AthenaQueryPolicy_v2 using current (non-deprecated) Athena APIs
while preserving the original AthenaQueryPolicy unchanged for backward
compatibility. This follows the established _v2 pattern used by
KMSEncryptPolicy_v2, StepFunctionsExecutionPolicy_v2, etc.

Fixes aws#3785
@roger-zhangg roger-zhangg force-pushed the fix/update-athena-deprecated-apis branch from ac2961c to 0eed981 Compare July 2, 2026 22:26
@roger-zhangg roger-zhangg changed the title fix: update deprecated Athena APIs in AthenaQueryPolicy template feat: add AthenaQueryPolicy_v2 with current Athena API actions Jul 2, 2026

@aws-sam-tooling-bot aws-sam-tooling-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Results

Reviewed: da148ea..0eed981
Files: 5
Comments: 1

Comment thread samtranslator/policy_templates_data/policy_templates.json Outdated
Address security review feedback:
- Remove athena:GetWorkGroup from Statement 1 (Resource: *) since it
  is already granted in Statement 2 scoped to the specific workgroup
- Move athena:GetDatabase and athena:GetTableMetadata to Statement 2
  (workgroup-scoped) for least-privilege
- Keep only list/discover actions in Statement 1 (Resource: *) since
  those don't support resource-level permissions
- Regenerate all 3 partition test expected outputs

@aws-sam-tooling-bot aws-sam-tooling-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Results

Reviewed: da148ea..08bb3f0
Files: 5
Comments: 1

Comment thread samtranslator/policy_templates_data/policy_templates.json Outdated
These actions operate on the datacatalog resource type, not workgroup.
Placing them in the workgroup-scoped statement would result in
AccessDenied at runtime since the ARN shapes don't match.

Statement 1 (Resource: *) now contains:
- List/discover actions (ListWorkGroups, ListDataCatalogs, etc.)
- Datacatalog-scoped actions (GetDatabase, GetTableMetadata)
- Glue equivalents (GetDatabase, GetDatabases, GetTable, GetTables)

Statement 2 (workgroup ARN) contains:
- Query execution actions
- GetWorkGroup (correctly scoped to specific workgroup)

Regenerated all 3 partition test expected outputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update deprecated Athena APIs in AthenaQueryPolicy template

1 participant